<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/page/common/commonConfig.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <link href="<%=basePath%>theme/images/sinologo.png" rel="Bookmark"  />
	<link href="<%=basePath%>theme/images/sinologo.png"  rel="Shortcut Icon" />
	<script type="text/javascript" src="<%=basePath%>dwrsystem/engine.js" ></script>
	<script type="text/javascript" src="<%=basePath%>dwrsystem/util.js"></script>  
	<script type="text/javascript" src="<%=basePath%>dwrsystem/interface/validateLogin.js" ></script>
	<script type="text/javascript" src="<%=basePath%>dwrsystem/interface/resourceService.js" ></script>
	<script type="text/javascript" src="<%=basePath%>component/notify.js"></script>
<script type="text/javascript">
var resourceImgpath = 'theme/${user.themeAddr }/resourceImgs/';
var redirectResourceUrl = '<%=basePath%>system/MainPageResourceAction!RedirectResource.action?resourceId=';

function changeWindowFull(){
	self.moveTo(0,0);
	self.resizeTo(screen.availWidth,screen.availHeight);
}

function initMainPageURL(){
	changeMainPageURL("<%=basePath%>page/frame/${frameFolder}/mainPage.jsp");
}

function loadingHeadImg(){
	var img = document.getElementById('imgphoto');
	if(!img)return;
	img.src = '<%=basePath%>theme/images/waitingLoadingImg.gif';
	img.onclick = openMySelfInfo;
	try{
		validateLogin.generateLoginImg('${user.userMainId}',
			function(data){
				if(data != 'null' && data != '' && data != null){
					dwr.util.setValue(img.id,data);
				}else{
					img.src = '<%=basePath%>theme/${user.themeAddr }/images/headPortrait/man.gif';
				}
			}
	  	);
	}catch(ex){img.src = '<%=basePath%>theme/${user.themeAddr }/images/headPortrait/man.gif';}
}

function openMySelfInfo(){
	openNewWindowURL('我的信息','<%=basePath%>page/system/personalInfo/main_user_person.jsp');
}

function changeClickTip(id){
	try{
		resourceService.selectTResourceAndParents(id,
			function(data){
				var tip = '';
				for(var i=0;i<data.length;i++){
					var d = data[i];
					tip+= ((tip!=''?'>>':'浏览路径：') + '<a href="javascript:changeMainPageURL(\''+redirectResourceUrl+d.resourceId+'\')">'+d.resourceName+'</a>');
				}
				document.getElementById('clickTip').innerHTML=tip;
			}
	  	);
	}catch(ex){myAlert('获取点击路径失败');}
}

function registerLoginStatus(){
	if('${user.userMainId}' != ''){
		try{
		validateLogin.registerLoginStatus('${user.tloginLog.logId}');
		}catch(e){alert('注册登录错误');}
	}
}

//noLogin.jsp使用
function timeOut(){
	document.location.href='<%=basePath%>';
}
//修改个人图片页面同时调用此方法修改首页头像
function changeHeadPortrait(path){
	document.getElementById('imgphoto').src = path;
}
function logout(){
	var logoutAddr = '<%=basePath%>system/LoginAction!logout.action';
	window.location.href=logoutAddr;
	waitingWindow();
}

function openCopyright(){
	var win = openNewWindowURL('copyright','<%=basePath%>page/system/copyright.jsp');
}

$(function (){
	changeWindowFull();
	initMainPageURL();
	loadingHeadImg();
	//二分钟执行一次
	setInterval(function(){
			registerLoginStatus();
		},1000*60*2);
});
</script>	
  </head>
</html>
